package com.ler.yrmall.product.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ler.yrmall.basic.Form;
import com.ler.yrmall.product.entity.BrandEntity;
import com.ler.yrmall.product.mapper.BrandMapper;
import com.ler.yrmall.product.service.BrandService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;


/**
 * @author leron
 */
@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, BrandEntity> implements BrandService {

    @Override
    public IPage<BrandEntity> find(Form request) {
        return this.page(request.getPage(),Wrappers.<BrandEntity>lambdaQuery()
                .like(StringUtils.isNotBlank(request.getKeyword()),BrandEntity::getName, request.getKeyword())
                .orderByAsc(BrandEntity::getSort));
    }

}